/*********************************************************************\
*                                                                     *
*         Jamper - Java XML mapper (visual XSLT generator)            *
*                Copyright (C) 2005 Filip Pavlovic                    *
*                    sqba@users.sourceforge.net                       *
*                                                                     *
*  This program is free software; you can redistribute it and/or      *
*  modify it under the terms of the GNU General Public License        *
*  as published by the Free Software Foundation; either version 2     *
*  of the License, or (at your option) any later version.             *
*                                                                     *
*  This program is distributed in the hope that it will be useful,    *
*  but WITHOUT ANY WARRANTY; without even the implied warranty of     *
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the      *
*  GNU General Public License for more details.                       *
*                                                                     *
*  You should have received a copy of the GNU General Public License  *
*  along with this program; if not, write to the Free Software        *
*  Foundation, Inc., 59 Temple Place - Suite 330, Boston,             *
*  MA 02111-1307, USA.                                                *
*                                                                     *
\*********************************************************************/


package sqba.jamper.map;


import java.awt.Point;
import java.util.Collection;

//import org.w3c.dom.Document;
//import org.w3c.dom.Document;
import org.w3c.dom.Element;

import sqba.jamper.map.object.IMapObject;
import sqba.jamper.util.PathList;


/**
 * Interface for all linkable objects.
 *
 * @author	Filip Pavlovic
 * @version	1.0
 */
public interface ILinkable extends IMapObject
{
	/**
	 * Returns true if this object is linked to any other object.
	 *
	 * @return true if this object is linked
	 */
	abstract boolean isLinked();

	/**
	 * Returns the pointer to the collection of LinkLine objects.
	 *
	 * @return pointer to the collection of LinkLine objects
	 */
	abstract Collection getLinks();


	/**
	 * Returns the top left point (origin).
	 *
	 * @return top left point
	 */
	abstract Point getOrigin();

	/**
	 * Returns true if the object represents the output.
	 *
	 * @return true if the object represents the output.
	 */
	abstract boolean isOutput();

	/**
	 * Returns the full path to the object.
	 *
	 * @return String, full path to the object.
	 */
	abstract String getFullPath();
	
	abstract String getXPath();

	/**
	 * If the object is output then it can have only one source.
	 * This function returns the pointer to this source object or null.
	 *
	 * @return pointer to the source object or null
	 */
	abstract ILinkable getSource();

	/**
	 * Checks if the link can be created between this object
	 * and the src parameter.
	 *
	 * @return true if the link can be created
	 */
	abstract boolean willAccept(ILinkable src);
	
	//abstract String render(PathList context, int level);
	
	/**
	 * Renders the element under parent node and returns the
	 * current context node.
	 * 
	 * @param context current XPath
	 * @param parent parent node
	 *
	 * @return current context node
	 */
	abstract Element render(PathList context, Element parent);
	
	abstract Element renderDeclaration(PathList context, Element parent);
	
//	abstract void renderDeclarations(PathList context, Element parent);
	
//	abstract Element renderDeclaration(PathList context, Document doc);
//	abstract boolean requiresEmbededDeclaration();
//	abstract boolean rendersComplexNode();
}
